import java.util.ArrayList;
import java.util.List;

/**
 * 1952. 三除数
 * https://leetcode-cn.com/problems/three-divisors/
 */
public class Solutions_1952 {
    public static void main(String[] args) {
        int n1 = 2;  // output: false
        int n2 = 4;  // output: true

        List<Integer> inputs = new ArrayList<>();
        inputs.add(n1);
        inputs.add(n2);

        for (Integer input : inputs) {
            boolean result = isThree(input);
            System.out.println(result);
        }
    }

    public static boolean isThree(int n) {
        int cnt = 0;
        for (int i = 2; i < n; i++) {
            if (n % i == 0) {
                cnt ++;
                if (cnt > 1) {
                    return false;
                }
            }
        }
        return cnt == 1;
    }
}
